1. Field of the Invention
The present invention relates to a communication device, a communication method, and a computer program for causing a computer to execute the communication method.
2. Description of the Related Art
In an IEEE 802.11 wireless LAN system, two communication modes are used, namely, an infrastructure mode, in which terminal stations carry out communications via control stations called access points (APs), and an adhoc mode, in which terminal stations carry out communications directly with each other without intervening APs. This is described, for example, in Japanese Patent Laid-Open No. 2003-348103.
Without limitation to wireless LANs, there exist communication systems having two communication modes, namely, a communication mode in which terminal stations carry out communications via control stations, and a communication mode in which terminal stations carry out communications directly with each other without intervening control stations. This is described, for example, in Japanese Patent Laid-Open No. 5-153039.
In the wireless LAN system, for example, a communication device has an AP mode, in which the communication device operates as an AP, and an STA mode, in which the communication device operates as a terminal station, and selects either the AP mode or the STA mode to carry out communications.
Such a communication device having a plurality of operation modes is activated in a predetermined operation mode, and connects to another communication device in a communication mode corresponding to the operation mode in which the communication device is activated. However, the communication mode of the connection does not necessarily match a desired communication mode. Furthermore, even when it is desired to switch the communication mode, when one of the devices is not capable of recognizing switching or is already carrying out communications with another device, communications that have been going on are suddenly interrupted when one of the devices unilaterally switches the communication mode.